#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    grid=new Grid(this);
    ui->main_layout->setStretchFactor(ui->grid_layout, 8);
    ui->main_layout->setStretchFactor(ui->oth_layout, 2);
    ui->grid_layout->addWidget(grid);
    connect(ui->begin_button,SIGNAL(clicked()),grid,SLOT(run_game()));
    connect(ui->set_normal_button,SIGNAL(clicked()),grid,SLOT(set_normal()));
    connect(ui->set_rect_button,SIGNAL(clicked()),grid,SLOT(set_rect()));
    connect(ui->set_plane_button,SIGNAL(clicked()),grid,SLOT(set_plane()));
    connect(ui->set_star_button,SIGNAL(clicked()),grid,SLOT(set_star()));
    connect(ui->set_key_button,SIGNAL(clicked()),grid,SLOT(set_ship()));
    connect(ui->create_random_button,SIGNAL(clicked()),grid,SLOT(random_init()));
}

MainWindow::~MainWindow()
{
    delete ui;
}
